{extend name="shop/blue/base" /}
{block name="resources"}
<!-- 添加css、字体文件文件 -->
<style type="text/css">
.common-btn{display: inline-block;}
.find_con .stepflex_te dl{width:240px;}
.alert ul {overflow: hidden;}
.ncm-default-form h3 {font-weight: 600;line-height: 22px;color: #555;clear: both;background-color: #F5F5F5;padding: 5px 0 5px 12px;border-bottom: solid 1px #E7E7E7;}
.ncm-default-form dl dt, .ncm-default-form dl dd {font-size: 12px;line-height: 32px;vertical-align: top;letter-spacing: normal;word-spacing: normal;text-align: right;display: inline-block;width: 14%;padding: 10px 1% 10px 0;margin: 0;}
.ncm-default-form dl dd {text-align: left;width: 85%;padding: 10px 0 10px 0;}
.ncm-default-form dl dt {width: 19%;}
.ncm-default-form dl dd {width: 79%;}
.ncm-default-form dl {font-size: 0;line-height: 20px;clear: both;padding: 0;margin: 0;border-bottom: dotted 1px #E6E6E6;overflow: hidden;}
.bottom{text-align: center;margin-top: 19px;}
.text{overflow: hidden;text-align: center;}
.text>ul>li{clear: both;}
.find_con .stepflex dl.doing,.find_con .stepflex_te dl{width: 260px!important;}
.find_con #sflex04{width: 780px!important;}
#description{border:1px solid #ddd;}
</style>
{/block}
{block name="main"}
<div class="margin-w1210">
	{include file='shop/blue/Member/controlLeftMenu'/}
	<div class="member-main">
		<div class="box">
			<div class="tabmenu"><ul class="tab"><li class="active" id="tab1">售后申请</li></ul></div>
			<div class="find_pw3">
				<div class="find_con">
					<div id="sflex04" class="stepflex stepflex_te">
						<dl class="first doing">
							<dt class="s-num">1</dt>
							<dd class="s-text">买家申请售后<s></s> <b></b> </dd>
						</dl>
						
						<dl class="normal">
						
							<dt class="s-num">2</dt>
							<dd class="s-text"> 商家处理售后申请<s></s> <b></b> </dd>
						</dl>
			
						
						<dl class="last">
					
							<dt class="s-num">&nbsp;</dt>
							<dd class="s-text">售后完成<s></s> <b></b> </dd>
						</dl>
					</div>
				</div>
			</div>
			<div class=" ncm-default-form">
				<div id="warning"></div>
				{include file='shop/blue/Member/controlCustomerStatus0'/}
			
			</div>
		</div>
	</div>
</div>
{/block}


{block name="RightSideBar"}{/block}
{block name="javascript"}
<script type="text/javascript">

var order_goods_id ={$order_goods_id};
$(function(){
	
	//如果退款原因是选择的其他就让用户自己写退款说明，"{:lang('member_other')}"
	$("#refund_reason").change(function(){
		if($(this).val()=="{:lang('member_other')}")
		{
			$('#description_dl').show();
		}else{
			$('#description_dl').hide();
		}
	});

	$("li[data-href^='{:__URL('SHOP_MAIN/member/orderlist')}']").addClass('current');
	$(".js-bread-crumb").attr("href",'{:__URL('SHOP_MAIN/member/orderlist')}');
	$(".js-bread-crumb").text("{:lang('member_my_order')}");
	
});



//保存退款信息
function btnSave() {
	var refund_require = $("#refund_require").val();
	var refund_reason = $("#refund_reason").val();
	var refund_money = $("#refund_money").val();//退款金额
	if($("#refund_money").val() == undefined){
	    var refund_money = 0;
    }
	var description = $("#description").val();//
	var maxRefundMoney = parseFloat($("#maxRefundMoney").val());

	if(refund_money == "" && refund_money !== 0){
		$.msg("{:lang('member_please_enter_refund_amount')}");
		$("#refund_money").select();
		return false;
	}
	if(isNaN(refund_money)){
		$.msg("{:lang('member_amount_not_entered_legally')}");
		$("#refund_money").select();
		return false;
	}
	if(refund_money < 0){
		$.msg("{:lang('member_amount_should_not_negative')}");
		$("#refund_money").select();
		return false;
	}
	if (refund_money > maxRefundMoney) {
		$("#refund_money").select();
		$.msg("{:lang('member_beyond_refund_amount')}");
		return false;
	}
	if (refund_money < 0 || refund_money > maxRefundMoney) {
		$("#refund_money").focus();
		$.msg("{:lang('member_beyond_refund_amount')}");
		return false;
	}
	if($('#refund_reason').val() == '{:lang('member_other')}'){
		refund_reason = description;
		if(refund_reason == ""){
			$.msg("{:lang('member_please_enter_refund_statement')}");
			return false;
		}
	}
	
	$.ajax({
		url: "{:__URL('SHOP_MAIN/order/orderGoodsCustomerServiceAskfor')}",
		type: "post",
		data: {"order_goods_id": order_goods_id, "refund_type": refund_require, "refund_money":refund_money, "refund_reason": refund_reason },
		dataType:"json",
		success: function (response) {
			if(response.code>0){
				window.location.reload();
			}else{
				$.msg(response.message);
			}
		}
	});
}
</script>
{/block}